import { Component, OnInit ,ViewChild,ElementRef,OnDestroy} from '@angular/core';

declare var Swiper;
@Component({
    selector: 'app-template-var',
    templateUrl: './template-var.component.html',
    styleUrls: ['./template-var.component.less']
})
export class TemplateVarComponent implements OnInit {
    pdom = "字符串";
    @ViewChild("loop",{
        static:true
    })
    loop:ElementRef;
    constructor() { 
        console.log("constructor方法");
    }

    ngOnInit() {
        this.initSwiper();
    }
    ngOnDestroy():void{
        console.log("结束");
    }
    getPdom(arg,e){
        console.log(arg,e);
    }
    printLoop(){
        console.log(this.loop);
        console.log(this.loop.nativeElement);
    }
    initSwiper(){
        new Swiper(this.loop.nativeElement,{
            autoplay:true,
        })
    }
}
